from django.db import models
import datetime
from typing import Iterable


# sqlmap数据库
class inject_data(models.Model):
    taskid = models.CharField(max_length=50)
    packet = models.TextField(default='')
    host = models.CharField(max_length=100)
    url = models.TextField(default='')
    dbms = models.TextField(default='')
    run_status = models.CharField(max_length=50, default='')
    status = models.CharField(max_length=10, default='0')
    parameter = models.CharField(max_length=20, default='')
    log_status = models.CharField(max_length=100, default='')
    api_address = models.CharField(max_length=100, default='')
    time = models.DateTimeField(auto_now=True)


# mimt过滤重复的数据
class filter_data(models.Model):
    host = models.CharField(max_length=100)
    data_packet = models.TextField()
    url = models.CharField(max_length=500)
    parm = models.TextField()
    status = models.CharField(max_length=10, default='0')
    taskid = models.CharField(max_length=100, default='')


# mimt所有代理数据
class proxy_data(models.Model):
    host = models.TextField(default='')
    url = models.TextField(default='')
    method = models.CharField(max_length=20, default='')
    request_headers = models.TextField(default='')
    scheme = models.TextField(default='')
    path = models.TextField(default='')
    request_cookies = models.TextField(default='')
    #port = models.CharField(max_length=20, default='')
    status_code = models.CharField(max_length=20, default='')
    response_headers = models.TextField(default='')
    response_content = models.TextField(default='')
    date = models.DateTimeField(auto_now=True)
    request_content = models.TextField()
    ip = models.GenericIPAddressField(default='0.0.0.0')
    http_version = models.CharField(max_length=20)


class sqlmap_log(models.Model):
    taskid = models.CharField(max_length=100)
    log = models.TextField(default='')





class auth_filter_raw(models.Model):
    host = models.CharField(max_length=100)
    path = models.CharField(max_length=100)
    method = models.CharField(max_length=10)
    url = models.TextField(blank=True,null=True)
    request_headers = models.TextField(default='')
    post_parm = models.TextField(blank=True,null=True)
    cookies = models.TextField(blank=True,null=True)
    get_parm = models.TextField(blank=True,null=True)
    cookies_status = models.CharField(max_length=100)
    get_list = models.TextField()
    post_list = models.TextField



    # cookieA_status = models.CharField(max_length=10,blank=True,null=True)
    # cookieB = models.TextField(blank=True,null=True)
    # cookieB_status = models.CharField(max_length=10,blank=True,null=True)


class authdata(models.Model):
    host = models.CharField(max_length=100)
    path = models.CharField(max_length=100)
    method = models.CharField(max_length=100)
    getparm = models.TextField()
    postparm = models.TextField()
    headers = models.TextField()
    cookies = models.TextField()


class authresult(models.Model):
    raw = models.ForeignKey(auth_filter_raw,on_delete=models.CASCADE)
    parm = models.CharField(max_length=100)
    result = models.CharField(max_length=10)